<?php
class Pages extends CI_Controller {

    public function view($page = 'home')
    {
		if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
		{
			// Whoops, we don't have a page for that!
			show_404();
		}

		$data['title'] = ucfirst($page); // Capitalize the first letter

		$this->load->view('templates/header', $data);
		$this->load->view('pages/'.$page, $data); //view()的第二个参数用于向视图传递参数， $data 数组中的每一项元素都将被赋值给一个变量，这个变量的名字就是数组的键值
		$this->load->view('templates/footer', $data);
    }
}
